<?php

/**
 * Tache form base class.
 *
 * @method Tache getObject() Returns the current form's model object
 *
 * @package    tfe
 * @subpackage form
 * @author     3emeIG
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseTacheForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'          => new sfWidgetFormInputHidden(),
      'id_contact'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('RelativeAUnePersonne'), 'add_empty' => true)),
      'id_groupe'   => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('RelativeAUnGroupe'), 'add_empty' => true)),
      'responsable' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Responsable'), 'add_empty' => true)),
      'type'        => new sfWidgetFormChoice(array('choices' => array('Communication' => 'Communication', 'Organisation d\'évènement' => 'Organisation d\'évènement', 'Administratif' => 'Administratif', 'Réunion' => 'Réunion', 'Autre' => 'Autre'))),
      'date'        => new sfWidgetFormDate(),
      'heure'       => new sfWidgetFormTime(),
      'priorite'    => new sfWidgetFormChoice(array('choices' => array('Urgent' => 'Urgent', 'Prioritaire' => 'Prioritaire', 'Normale' => 'Normale', 'Faible' => 'Faible'))),
      'effectue'    => new sfWidgetFormInputCheckbox(),
      'commentaire' => new sfWidgetFormTextarea(),
      'deleted_at'  => new sfWidgetFormDateTime(),
      'created_at'  => new sfWidgetFormDateTime(),
      'updated_at'  => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'          => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
      'id_contact'  => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('RelativeAUnePersonne'), 'required' => false)),
      'id_groupe'   => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('RelativeAUnGroupe'), 'required' => false)),
      'responsable' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Responsable'), 'required' => false)),
      'type'        => new sfValidatorChoice(array('choices' => array(0 => 'Communication', 1 => 'Organisation d\'évènement', 2 => 'Administratif', 3 => 'Réunion', 4 => 'Autre'), 'required' => false)),
      'date'        => new sfValidatorDate(),
      'heure'       => new sfValidatorTime(array('required' => false)),
      'priorite'    => new sfValidatorChoice(array('choices' => array(0 => 'Urgent', 1 => 'Prioritaire', 2 => 'Normale', 3 => 'Faible'), 'required' => false)),
      'effectue'    => new sfValidatorBoolean(array('required' => false)),
      'commentaire' => new sfValidatorString(array('required' => false)),
      'deleted_at'  => new sfValidatorDateTime(array('required' => false)),
      'created_at'  => new sfValidatorDateTime(),
      'updated_at'  => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('tache[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Tache';
  }

}
